package diShiYiZhou;

import java.util.Arrays;
import java.util.Random;

public class fangFa {
    //遍历数组
    public static int[] ChuShiHua(int[] array)
    {
        int i=0;
        int sz=array.length;
        for(i=0;i<sz-1;i++)
        {
            array[i]=i-1;
        }
        return array;
    }

    //查找
    public static boolean find(int x,int[] array1)
    {
        int i=0;
        for(i=0;i<array1.length;i++)
        {
            if(array1[i]==x);
            return true;
        }
        return false;
    }

    //遍历获奖数组
    public static int[] hjr(int[] array,int[] array1)
    {
        Random ret=new Random();
        int count=0;
        while(count<array.length)
        {
            int ret1=ret.nextInt(50)+1;
            if(find(ret1,array1)==true)
            {
                array[count]=ret1;
                array1[ret1-1]=0;
                count++;
            }
        }
        System.out.println("获得"+count+"等奖的人是"+ Arrays.toString(array));
        return array1;
    }
}
